package gui;

import javax.swing.*;

import javax.swing.border.Border;

import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class FrameMenu extends JFrame implements ActionListener{
	
	JPanel   p;
	JButton  b;
	JMenuBar menu;
	JMenu    fichier,dynamic,plugins;
	public FrameMenu()
	{
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setBounds(100, 100, 450, 300);
		this.setLayout(new BorderLayout());
		
		p       = new JPanel();
		b		= new JButton("test");
		menu    = new JMenuBar();
		fichier = new JMenu("fichier");
		dynamic = new JMenu("dynamic");
		plugins = new JMenu("Plugins");
		
		p.setLayout(new BorderLayout());
		b.addActionListener(this);
		p.add(b,BorderLayout.CENTER);
		p.add(new JPanel(),BorderLayout.NORTH);
		p.add(new JPanel(),BorderLayout.WEST);
		p.add(new JPanel(),BorderLayout.SOUTH);
		p.add(new JPanel(),BorderLayout.EAST);
		this.add(p);
		
		menu.add(fichier);
		menu.add(dynamic);
		this.setJMenuBar(menu);	
		
		fichier.add(new AbstractAction("action") {
						
			@Override
			public void actionPerformed(ActionEvent e) 
			{
				System.out.println("test menu !");
				JOptionPane.showMessageDialog(null, new String("test fichier"));
			}
		});
		
		
		
		
		
		plugins.add(new AbstractAction("action") {
						
			@Override
			public void actionPerformed(ActionEvent e) 
			{
				System.out.println("test menu !");
				JOptionPane.showMessageDialog(null, new String("test fichier"));
			}
		});
		dynamic.add(plugins);
		
	}

	public void actionPerformed(ActionEvent e) 
	{
		System.out.println("test menu !");
		JOptionPane.showMessageDialog(null, new String("test fichier"));
	}
}
